﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using control.Biz;
using System.Collections.Generic;

namespace TrangSucShop.usercontrol
{
    public partial class frmFind : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<BizLoaiSanPham> loais = new List<BizLoaiSanPham>();
                loais = BizLoaiSanPham.GetAll();
                BizLoaiSanPham tatca = new BizLoaiSanPham(0, "", "tất cả ");
                loais.Add(tatca);
                DropDownList1.DataSource = loais;
                DropDownList1.DataTextField = "TenLoai";
                DropDownList1.DataValueField = "MaLoai";
                DropDownList1.SelectedIndex = loais.Count - 1;
                DropDownList1.DataBind();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int giatu = 0;
            int giaden = int.MaxValue;
            try { giatu = Convert.ToInt32(TextBox2.Text); }
            catch { }
            try { giaden = Convert.ToInt32(TextBox3.Text); }
            catch { }
            string url = "find.aspx?Loai=" + DropDownList1.SelectedValue.ToString() + "&SP=" + TextBox1.Text+"&GT="+giatu+"&GD="+giaden;
            Response.Redirect(url);
        }
    }
}